home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 4
/
Merciful - Disc 4.iso
/
software
/
p
/
psychotoads.dms
/
psychotoads.adf
/
a3
< prev
next >
Wrap
Text File
|
1989-03-31
|
44KB
|
1,075 lines
3: THE EDITOR 11
-----------------------------
The AMOS editor provides you with a massive range of editing
facilities. Not only is it exceptionally powerful, but it's also
delightfully easy to use. All commands can be executed either directly
from the screen, or via an impressive range of simple keyboard
alternatives. It's so friendly in fact, that if you've a little
experience with computers, you'll propably be able to use it straight
out of the box.
One of the most exciting features of this sytem, is that the listing
is displayed completely separately from your main program screen. So
you can instantly flick from your program display to the editor window
using a single keypress (ESCape).
If you've plenty of memory, it's also possible to load several
programs in AMOS Basic at a time. Each program can be edited totally
independently, and it's possible to efforlessly switch between the
various programs in memory by pressing just two keys from the editor.
The first thing you see after AMOS has loaded into memory is a
standard credit screen. Applause applause! Press a key to remove this
window and enter the editor.
The menu window
===============
At the top of the screen, there's a menu window containing a list of
the currently available commands. This forms the gateway to all AMOS
Basic's powerful editing features. Command can be quickly executed by
moving the mouse pointer over an item, and hitting the left mouse
button. Each command is also assigned to a particular function key.
In addition to the main menu, there are also a number of other menus.
The most important of these menus is the SYSTEM menu. This can be
brought into view by either holding down the right mouse button, or
pressing the shift key from the keyboard.
The SYSTEM manu contains a range of options such as LOAD, SAVE, NEW,
etc. Like the main menu, all options can be executed using either the
left mouse button, or by pressing an appropriate function key.
The information line
====================
I L=1 C=1 Text=40000 Chip=91000 Fast=0 Edit:example
The markers at the far left display the editor mode ((I)nsert or
(O)verwrite). There's also an indication of the (L)ine and (C)olumn you
are presently editing. Alongside these markers is a list of three
numbers:
TEXT: Measures the amount of memory which has been assigned to the
editor window. This can be adjusted within AMOS Basic using a simple
SET BUFFER command from the SEARCH MENU.
CHIP: Free Chipmem 12
FAST: Free Fastmem; Whenever possible, this will be used.
EDIT: Displays the name of the program you are currently editing.
Initially this area will totally blank, but when you load or save a
program to disc, the new filename will be automatically entered to the
information line.
The editor window
=================
The editor window forms the heart of the AMOS system, and allows you to
type your Basic program listings directly from the keyboard. All text
is inserted at the current cursor position, which is indicated by a
flashing horizontal line.
At the start of your session, the cursor will always be placed at the
top left hand corner of the editing window. It can be moved around the
current line using the left and right cursor keys.
Your line can be edited on a character by character basis using the
Delete and Backspace keys. Delete erases the character immediately
underneath the cursor, whereas Backspace deletes the character to the
left of this cursor. As an example, type the line:
print "AMOS"
When you press Return, your new line will be entered into AMOS Basic.
Anything AMOS recognices as a command will be immediately converted to
special format. All Basic commands begin with a Capital letter and
continue in lower case. So the previous line will be displayed as:
Print "AMOS"
Similarly, all AMOS variables and procedures are displayed in CAPITALS.
This lets you quickly check whether you've made a mistake in one of
your program lines. Supposing for instance, you'd entered a line like:
inpit "What's your name;";name$
This would be displayed as:
Inpit "What's your name;";NAME$
Since INPIT is in UPPER case, it's immediately obvious that you've made
an error of some sort.
Ok. Now for a little fun. Move the cursor under the Print command you
entered a few moments ago and type in the following lines of Basic
Instructions.
centre "<Touch 'n' Type Demo> 13
do
x$=inkey$ : if x$ <> "" then print x$
loop
Don't forget to press the Return key after each and every line. Now
move the cursor through your new program using the arrow keys. Finally,
press the F1 to run this program.
The EDITOR WINDOW will disappear and a separate PROGRAM display will
flip into place. The program now expects you to type in some text from
the keyboard. As you can see, the program screen has its own
independent cursor line. This is totally separate to the one used by
the editor. So you can play about as much as you like, without changing
your current editing position.
After you've finished, press CTRL+C to abort the program. A thin line
will now be displayed over the screen. This can moved using the up and
down cursor arrows.
Program Interrupted at line 4
>>>Loop
Pressing the space bar at this point would return you back to editor.
But since we've already seen the editor, let's have a brief look at the
Direct mode instead. Hit the ESCape key to flip this mode into place.
An introduction to Direct mode
==============================
DIRECT mode provides you with an easy way of testing your Basic
programs. For the time being, we'll examine just a couple of its more
interesting features.
All direct mode commands are entered into a special screen which is
completely indepentent from the program display. You can move this
screen up or down using the arrow keys.
At the top of the window, there's a list of 20 function key
assignments. These represent a list of commands which have been
previously assigned to the various function keys. They can be accessed
by hitting the left or right Amiga-keys in combination with one of the
various function keys.
Whilst you're in direct mode, you can execute any Basic instructions
you like. The only exceptions are things like loops or procedures. As
with the editor, all commands should be entered into the computer by
pressing the Return key. Here are some examples:
Print 42
ANSWER=6. Print ANSWER*9
Curs Off
Close Workbench (Saves around 40k but ABORTS multi-
tasking operations!)
It's important to recognize that no matter what you do in direct mode,
there will be absolutely no effect on the current program listing. So
you can mess about to your heart's content, with no risk of deleting
something in your Basic program.
It's now time to return to the Editor window. So wave a fond farewell
to Direct mode, and enter the editor by pressing ESCape.
Loading a program 14
=================
We'll now discuss the various procedures for loading and saving your
programs on the disc. As usual, these options can be executed either
from the MENU window or using a range of simple two-key commands from
the editor. The fastest way to load a program is to hold down either of
Amiga keys, and press the letter L.
You'll now be presented with the standard AMOS file selector window.
Nowadays, file selectors have become a familiar part of most packages
available on the Amiga. So if you've used one before, the AMOS system
will hold no real surprises. However, since the file-selector is such
an integral part of AMOS Basic, it's well worth explaining it in some
detail.
The AMOS file selector
======================
Selecting a file from the disc couldn't be easier. Simply move the
cursor over the required filename so that it's highlighted in reversed
text. To load this file into memory, click twice on the left mouse
button. Alternatively, you can enter the name straight from the
keyboard, and just press Return.
If you make a mistake, and wish to leave the selector without loading
a file, move the mouse over the Quit button and select it with the left
button. AMOS will abort your operation and display a "Not Done" message
on the information line.
As an example, place you COPY of the AMOS program disc into the
internal drive and press AMIGA+L to load a file. If you've been
following out tutorial, AMOS will give you the option of saving the
existing program first. Unless you've made any interesting changes,
press "N" to anter the file-selector. Otherwise, see "saving a program"
for further instructions.
When the file selector appears, look out for a file with the name
"Hithere.AMOS". Once you've found it, load it. The following listing
will be loaded to amos basic.
Rem Hi there AMOS users
Cls 0 : Rem Clear the screen with colour zero
Do
Rem get some random numbers
X=Rnd(320):Y=Rnd(200):I=Rnd(15):P=Rnd(15)
Ink I,P : Rem add a little colour
Text X,Y,"Hi there!" : Rem graphic text
Loop
Move the text cursor over the text "Hi There!" and insert you own
message. Now press F1 to run the program. The program display will
rapidly fill up with dozens of copies of your text. Press CTRL+C to
exit from this routine.
Saving a Basic program 15
======================
Return to the editor window, and type ALT+S to save your current
program onto the disc. If you feel like a change, hold down the right
mouse key and click on the "Save as" option from the SYSTEM menu with
the left button. Either way you'll jump straight back to the AMOS file
selector window.
You should now enter the name of your new file straight from the
keyboard. As you type, your letters will appear in a small window at
the bottom of the selector. Like the editor, there's a cursor at the
current typing position. This cursor can be moved around using all the
normal editing keys Finally, press Return to save your prog to disc.
Scrolling through your files
============================
If your disc is reasonably full, the standard selection window won't be
able to list the entire contents of your disc at once. You can page
through the listing using the scroll bar to the left of the selection
window.
Changing the current drive
==========================
To the right of the file window, there's a list of drive names. The
precise contents of the window will naturally depend on the devices
you've connected to your Amiga. If you have several drives, you can
switch between them by simply clicking on the appropriate name. The
directory of this drive wlil now be entered into the selection window.
Changing the directory
======================
When you search through the directly listing, you'll discover several
names with an asterix character "*" in front of them. These are not
files at all. They are entire directories in their own right.
You can enter one of these folders by selecting them with the left
mouse button. You may then choose your files directly from this folder.
Note that only the files with the current extension ".AMOS" will be
displayed.
Once you've opened a directory, you can set it as the default using
the SETDIR button. The next time you enter the file selector or obtain
a directory listing with DIR, your chosen folder will be entered
automatically. Similarly, you can move back to the previous directory
by clicking on the PARENT button.
Setting the search path
=======================
Normally, AMOS will search for all filenames with the extension
".AMOS". If you want to laod a file with another extension such as
.BAK, you can edit the search pattern directly. This can be acomplished
in the following way.
Move the text cursor to the PATH window by pressing with the up arrow
from the keyboard. Now type your new path and hist Return. A full
description of the required syntax can be found in the section on the
DIR command.
WARNING!: AMOS uses its own individual search patterns which are very 16
different from the standard Amiga Dos System. If you're unsure, delete
the entire line up to the current VOLUME or DRIVE name and hit Return.
This will present you with a full list of ALL the files on the present
disc.
Using the file selector
=======================
Interestingly enough, it's also possible to call this file-selector
directly from your own programs. For a demonstration, enter DIRECT mode
and type the following line:
Print Fsel$(*.*)
After you've chosen a file, the name you've selected will be printed
straight onto screen! See FSEL$ for a detailed explanation of this
command.
Editor tutorial
===============
We'll now have a brief look at some of the more advanced editing
features available from the AMOS editor. We'll start by loading an
example program from the disc. Just for a challenge, we've placed this
in a separate MANUAL folder on the AMOS program disc.
Insert your COPY of the program disc into your Amiga'
Scrolling through a listing
===========================
Alongside the main editor window are two "scroll bars". These allow you
to page through your listing with the mouse.
Move the mouse pointer over the Vertical bar and hold down the left
button. Now drag the bar down the screen. The editor window will
scrolls moothly downwards through the listing. You can also scroll the
program using the Arrow Icons at the top and bottom of this bar.
Clicking on these icons moves the line exactly one place in the
required direction.
At the far bottom of the editor window, there's a horizonal scroll
bar. This can be used to move the window left and right in exactly the
same way.
If you prefer to use the keyboard for your editing, you'll be pleased
to discover that there are dozens of equivalent keyboard options as
well. For example;
CTRL+UP Arrow shift the listing to the previous page.
CTRL+DOWN Arrow moves the listing to the next page
All the keyboard options obey the same basic principles. So once you've
familiarised yourself with one command, the rest are easy. A full list
of these commands can be found towards the end of this chapter.
Now we've looked at the program. It's time to actually change
something. Search through the program listing until you find the line:
ALERT[50,"Alert box","","Ok","Cancel",1,2]
This calls a Basic procedure which displays a working alert box on the
screen. The format of this procedure is:
ALERT[Y coord,Title 1$,Title 2$,Button 1$,Button 2$,Paper,Ink]
Let's change this alert to something a little more exciting. Move the
cursor over the above statement, and edit the line with the cursor keys
so that it look like so:
ALERT[50,"Exterminate!","Securitate","Yep!","Yep!",1,3]
Execute the program by pressing F1 or selecting RUN from the main menu.
You'll be given the unique option of stopping the lamest Amiga-group in
the World in its tracks. Select a button with the mouse and make your
choice!
In practive, you can change the title and the buttons to literally
anything you like. Feel free to use this routine in your own progs.
Hopefully, the above example will have provided you with a real spur
to use procedures in your own programs. In order to aid you in this
task, we've built a powerful range of special editing features into the
AMOS editor.
Label/procedure searches 17
========================
If your program is very long, it can be quite hard to find the starting
points of your various procedure definitions. We've therefore included
the ability to jump straight to the next procedure definition in your
program, using just two keys (Alt+Arrow)
For an example, place the cursor at the start of the listing and
press Alt+down arrow. Your cursor will be immediately moved to the
beginning of the first procedure definition in the current program
(ALERT). You can repeat this process to jump to each procedure
definition in turn.
This system is not just limited to procedures of course. It also
works equally well with Labels or line numbers. So even if you don't
need procedures, you'll still find a use for this feature.
Folding a procedure definition 18
==============================
If you build up your programs out of a list of frequently used
procedures, your lisings an easily be cluttered with the definitions of
all your various library routines.
Fortunately, help is at hand. With a simple call to the Fold command,
you can hide away any of your procedure definitions from your listings.
These routines can be used in your program as normal, but their
definitions will be replaced by a single Procedures statement. Example:
Position the cursor anywhere in the definition of ALERT and click on
the Fold/Unfold option from the menu window. Bing! The contents of your
procedure will vanish into thin air! Despite this, you can run the
program with no ill effects. The only change has been in the appearance
of the listing in the editor window.
Just select Fold/Unfold again, and your procedure will be expanded to
it's fully glory.
It's also possible to fold ALL the procedures in your program at
once. This uses an option on the SEARCH menu called "Close All". To
bring the Search menu onto the screen, click on the button with the
same name, or press F5 from the keyboard. Now select the Close All
button to remove the procedure definitions from the current program.
The effect on EXAMPLE 3.1 is dramatic! The entire program now fits
into just a single screen. So you can instantly see the procedures
we've been using in the program. Each procedure definition can be
edited individually by expanding it with the Fold/Unfold button. Or you
can unfold the whole program with "Open All" from the Search menu.
Search/Replace
==============
The search/replace commands provided by the AMOS Basic editor are
accessed through a special Search menu which can be called up either
from the menu window or by pressing function key F4.
Finding an item
===============
We will continue our tutorial with a brief look at of some of the
Search/replace instructions. Let's start with the FIND command.
This can be executed either directly from the Search menu or using
the keys CTRL+F. When you select this command, you'll be asked to enter
the search string.
For example, hit CTRL+F and type "Rem" at the prompt. AMOS ill now
search for the next "Rem" statement in your program, starting from the
current cursor position. If the search is succesful, then cursor will
be replaced over the requested item.
The search can now be repeated from this point with the "Find Next"
option (CTRL+N).
Replace
=======
Supposing we wanted to change all the Rem statements in a program with
the equivalent "'" characters. This could be accomplished with the
"Replace" command.
In order to use this option, it's necessary to define the replacement
string. So the first time you call up replace, you will always be asked
to enter this string from the keyboard.
Press CTRL+R, type in ' (apostophe) at the prompt and hit the return
key to enter it into the computer. You now set the search string with
the "Find" option like so:
* Press CTRL+F to select the FIND option.
* Type "Rem" into the information line.
* The cursor will then be moved straight to the next Rem statement in
your program listing.
To change this to the replacement string and jump to the next
occurrence, select Replace (CTRL+R) once again. Alternatively, if the
Rem is in the middle of the line, you'll need to skip it, because AMOS
only allows you to substitute a quote for this command at the start of
a line. You can avoid this problem and jump directly to the next item
in your program using "Find Next".
Cut and paste 19
=============
The AMOS Block commands allow you to cut out parts of your programs and
save them in memory for future use. Once you've created a block, you
can copy it anywhere you like in the current listing.
Here's an example of this feature in action. Let's take the previous
ALERT program, and cut out a single procedure. Place the mouse pointer
over the first line of the INVERT procedure, and depress the right
mouse button. We can now enter this procedure into a block using the
mouse. As you move the mouse, the selected area will be highlighted in
reverse.
We can now grab this area into memory using "Cut". When you press
CTRL+C from the keyboard, the procedure will be removed from the
listing and stored into memory. It's now possible to paste this block
anywhere you like in your program. For the purposes of our example,
move the text cursor down to the bottom of the listing, and call the
Paste optin with CTRL+P. The INVERT procedure wlil now be copied to the
current cursor position.
Multiple programs and accessories
=================================
Multiple programs
-----------------
Although AMOS only allows you to edit a single program at a time,
there's no limit to the number of programs which can be installed into
memory, other than the amount of available storage space. Once you've
installed a program in this way, you can execute it straight from
Editor window with the "Run Other" option.
Supposing, for instance, you encounter a problem in one of your
programs. AMOS will let you effortlessly swap your existing program
into memory so that you can freely experiment with the various
possibilities until you find a solution. After you've finished, you can
now grab your new routine into memory with the cut option, and flick
back into your original program by pressing just two keys! The new
routine can the be pasted into position, and you can continue with your
program as before. The ability to stop everything and try out your
ideas immediately, is incredibly valuable in practice.
Another possibility is to permanently keep all the most commondly
neede utilities such as the sprite definer or the map editor in the
memory. You can now access these utilities instantaneously, whenever
you need them.
In fact, AMOS includes a special ACCESSORY system which makes this
even easier. The utility programs can be given total access to all the
memory banks in your main programs. So the sprite definer can grab the
images straight from your current program, and modify them directly.
This tehcnuque speeds up the overall development process by an amazing
degree!
Let's have a quick demonstration of these facilities. Enter the
following small prog into the editor:
Print "This is program One"
Boom
We can now push this program into memory using the push command. This
is called up by pressing AMIGA+P. You'll then be asked to enter the
name of your program from the information line. Type in a name like
"Program1" at this point. The edit screen will be cleared completely.
The new window is totally separated from your original program. As a
demonstration, enter a second routine like so:
Print "This is program Two"
Shoot
This program can now be executed from the editor window using RUN (F1). 20
But when your return you can immediately jump to the old one with the
"Flick" option. Try pressing AMIGA+F. As before, you'll be asked to
enter a name for your program. Use a name like "program2" for this
purpose. The editor will now jump straight to your original program as
if by magic. It's possible to repeat this process to jump back and
forth between the two programs. Each program is entirely independent
and can have it's list of own banks and program screens.
So far, we've only discussed how you can use two programs at a time.
However, you can actually have as many program in memory as you like.
These programs can be selected individually using the "Run Other" and
"Edit Other" options from the Menu window. When you call these
commands, a special "program" selector will be displayed on the screen.
The program selector is almost identical to the familiar AMOS file
selector. The only difference is that it allows you to choose a program
from memory rather than from the disc. You can select a program by
simply highlighting it with the mouse cursor and clicking once on the
left button.
Accessories
-----------
In order to distinguish accessories from normal Basic programs, they're
assigned a ".ACC" extension instead of the more usual ".AMOS".
Accessories can be loaded into memory like any normal program using the
"Load Other" command.
Load Other presents you with a normal fileselector which can be used
to load an accessory program from the disc. After the accessory has
been installed into memory you will be returned straight back to your
current program. You can now run this accessory at any time using the
Run Other option from the menu window. Simply move the mouse pointer
over your required accessory and press the left button.
Alternatively, you can load all the accessories from the current disc
using the Accnes/Load feature. This option can be found on the System
menu which is displayed when you hold down the right mouse button.
Accnew/Load erases all existing accessories and loads a new set from
the current disc.
For a demonstration, place the AMOS Program disc into your drive, and
click on the Accnew/Load button from the System menu.
The HELP accessory will be quickly loaded into memory. HELP is a
special accessory because it can be called up directly by pressing the
HLEP key. We've packed this program with all the information you'll
need about the accessor yprograms supplied with AMOS Basic. All you
need to do, is just follow the prompts which will be displayed on the
screen.
Direct mode 21
===========
The Direct mode window can be entered from the editor by pressing the
ESCape key at any time. As a default, the window is displayed in the
lower half of the screen, with the program screen in the background.
If you run a program that changes the screen format, displays
windows, animates sprites etc, then all this screen data will remain
intact. So you can move the DIRECT window around or flip back to the
editor to make program changes without destroying the current program
screen. This DIRECT mode window is totally independent and is displayed
on its own front level screen.
Whilst you're within direct mode you can type any line of AMOS Basic
you wish. The only commands you cannot use are loops and branch
instructions. You only have access to normal variables (as distinct
from the loca bariables defined in a procedure).
Direct mode editor keys
=======================
ESCape Jump to the editor window
Return Executes the current line of commands
DELete Delete character under cursor/
Backspage Delete character to the left of the cursor
Left Arrow Move cursor left
Right Arrow Move cursor right
Shift+Left Skip a word to the left
Shift+Right Skip a word to the right
Shift DELete Deletes entire line.
Shift BACK Ditto
Help Displays the function key definitions to the
direct window.
F1 to F10 These keys remember the last 10 lines you've
entered from the direct mode. F1 displays the
latest one entered, F2 the second to last, etc. The memory area used by
this system is always cleared when you return to the editor window or
run one of your programs.
The menu window 22
===============
There's a detailed explanation of all the options which are available
from the main menu window.
Default menu
------------
This gives you various commands that allow you to operate the editor,
plus give you access to the block and search menus.
RUN (F1) Runs the current program in memory
TEST (F2) Cheks the program syntax
INDENT (F3) Takes the current program and indents the listing.
BLOCKS MENU (F4) Displays the Blocks menu.
SEARCH MENU (F5) Displays the Search menu
RUN OTHER (F6) Runs a program or accessory in memory
EDIT OTHER (F7) Edits a program which has previously installed into
memory using the "Load Other" or "Accnew/Load".
OVERWRITE (F8) Toggles between insert and overwrite -editing modes.
FOLD/UNFOLD (F9) Takes a procedure definition and folds it away inside
your program listing.
Normally, it's possible to re-open a folded procedure by repeating
the process. Place the cursor over a folded procedure and click on
FOLD/UNFOLD. If you feel the need for extra security you can also call
up a special LOCK accessory from the AMOS Program disc. This will ask
for a code word, and will lock your procedures so that they can't be
subsequently examined from AMOS Basic. Simply fold your required
proceduers and load FOLD.ACC using the LOAD OTHERS command. Full
instructions are included with the utility.
The real beauty of this system is that it allows you to create whole
libraries of your routines on the disc. These can be loaded into memory
as a separate program (See LOAD OTHER). You can now cut out the routine
you need and copy them directly into your main program. So once you've
written a routine, ou can place it into a procedure and reuse it again
and again.
If you're intending to use this sytem, there are several points to
concider.
* Whenever you fold or unfold a procedure a syntax check is made of
the entire program. If an error occurs the operatoni will not be
performed. So it's vital that you keep back-up copies of all your
procedures in Unfo
The system menu 24
---------------
LOAD (SFT+F1 / AMIGA+L) Loads an AMOS Basic Program
SAVE (SFT+F2 / AMIGA+S) Saves the current Basic Program
SAVE AS (SFT+F3 /SFT+AM+S) Saves the prog with another name
MERGE (SHIFT+F4) Enters the chosen prog at the current
csrs position without erasing the current
program.
MERGE ASCII (SHIFT+F5) Merges an Ascii version of an AMOS Basic 25
program with the existing program in memory
AC.NEW/LOAD (SHIFT+F6) Enters a new accessory set from the disc
LOAD OTHERS (SHIFT+F7) Loads a single accessory from the disc
NEW OTHERS (SHIFT+F8) Erases accessorie(s) from memory
NEW (SHIFT+F9) Erases the current program from memory
QUIT (SHIFT+F10) Exits AMOS and returns control to the CLI
The blocks menu
---------------
BLOCK START (CTRL + B/F1) Sets the starting point for the current block
BLOCK END (CTRL + E/F6) Defines the end of a block
BLOCK CUT (CTRL + C/F2) Removes the selected block into memory 26
BLOCK PASTE (CTRL + P/F7) Pastes the block to the current csrs position
BLOCK MOVE (CTRL + M/F3) Move the block to the current cursor position
erasing the original version completely
BLOCK STORE (CTRL + S/F8) Copies the block into memory.
BLOCK HIDE (CTRL + H/F4) Deselects the block you've highlighted
BLOCK SAVE (CTRL + F9 ) Saves the current block on the disc as an
AMOS program
SAVE ASCII (CTRL + F5 ) Stores your selected block on the disc as
a normal text file.
BLOCK PRINT (CTRL + F10) Outputs the selected block to the printer
The search menu
---------------
FIND (ALT + F1) Enters a string of up to 32 chars and
searches through your text until a match is
found.
FIND NEXT (ALT + F2) Searches for the next match you specified
FIND TOP (ALT + F3) Searches from the top of program the string
rather than starting from the crsr position
REPLACE (ALT + F4) Activates REPLACE mode. The effect of this
command varies depending when it's used:
* Before a FIND
You'll now be asked to enter the replacement
string from the keyboard
* After a FIND
If the search operation was succesful, the text and
the current cursor position will be swapped with the
replacement string. REPLACE will now jump to the next
occurrence of the search string.
REPLACE ALL (ALT + F5) Replaces ALL copies of a word in your prog.
LOW <> UP (ALT + F6) Changes the case sensitivity used in search
commands
OPEN ALL (ALT + F7) Opens all closed procedures in your program
CLOSE ALL (ALT + F8) CLoses all procedures in your program
SET TEXT B (ALT + F9) SET TEXT BUFFER. Changes the # of chars
available to hold your listings.
SET TAB (ALT + F10) Sets the number of chars which the crsr will
be moved when the user presses the TAB key.
Keyboard macros 28
---------------
=KEY$= (define a keyboard macro)
KEY$(n)=command$
command$)=KEY$(n)
KEY$ assigns the contents of command$ to function key number n. (1-20)
Keys from one to ten are accessed by pressing the function key in
conjuction with the left Amiga button. Similarly, numbers from eleven
onwards are called with a right Amiga Fn combination.
Command$ can be any string of text you wish, up to maximum of 20
characters. There are two special characters which are directly
interpreted by this function:
' (Alt+Quote) Generates a Return code
' (single Quote) Encloses a comment. This is only displayed in your
key lists. It's totally ignored by the macro routine.
Examples:
? Key$(1)
Key$(2)="Default"
Alt+F2
Key$(3)="'Comment print"
In practice, this macro system can prove incredibly useful. Not only
can you speed up the process of entering you Basic programs, but you
can also define a list of standard inputs for your Basic programs.
These would be extremely effective in an adventure game, as can be seen
from the program EXAMPLE 3.2 in the MANUAL folder.
If you wish to generate a keypress which has no ASCII equivalent such
as up arrow, you can optionally include a scancode in these macros.
This is achieved using the SCAN$ function.
=SCAN$ (return a scan code for use with KEY$) 29
x$=Scan$(n,[,m])
n is the scancode of a key to be used in one of your macro definitions.
m is an optional mask which sets the special keys such as CTRL or Alt,
in the following format:
Bit Key Tested Notes
--- ---------- -----
0 Left SHIFT
1 Right SHIFT
2 Caps Lock Either ON or OFF
3 CTRL
4 Left ALT
5 RIght ALT
6 Left AMIGA Commodore key on some keyboards
7 Right AMIGA
If a bit is set to a one, then the associated button is depressed in
your macro. Examples:
KEY$(4)="Wheee!"+Scan$($4C)
KEY$(5)="Page Up!"+Scan$($4C,%00010000)
Conserving memory 30
=================
CLOSE WORKBENCH (closes the workbench)
CLOSE WORKBENCH
Closes the workbench screen saving around 40K of memory for your
programs! Example:
Print Chip Free,Fast Free
Close Workbench
Print Chip Free,Fast Free
CLOSE WORKBENCH can be executed either from direct mode, or inside on
of your Basic programs. A Typical program line might be:
If Fast Free=0 Then Close Workbench
This would check for a memory expansion and close the Workbench if
extra memory was not available.
CLOSE EDITOR (close editor window)
CLOSE EDITOR
Closes the Editor window while your program is running, saving you more
than 28K of memory. Furthermore, there's absolutely NO effect on your
program listings!
If there's not enough memory to reopen the window after your program
has finished, AMOS will simply erase your current display and revert
back to the standard DEFAULT screen. You'll now be able to effortlessly
jump back to the Editor with the ESCape key as normal. What a terrific
little instruction!
Inside accessories
==================
We'll now explore the general techniques required to write your own
accessory programs. These are really just specialised form of the
multiple programs we discussed a little earlier. As you would expect,
they can incorporate all the standard Basic instructions.
Accessories are displayed directly over your current program screen
and the music, sprite, or bob animations are automatically removed from
the screen.
Your accessory should therefore check the dimensions and type of this
screen using the SCREEN HEIGHT, SCREEN WIDTH and SCREEN COLOUR commands
during its initialisation phase. If the current screen isn't
acceptable, you may be forced to open a new screen for the accessory
window or to erase the existing screens altogether with a DEFAULT
instruction.
Any memory banks used by your accessory are totally independent of
the main program. If it's necessary to change the banks from the
current program, you can call a special BGRAB command.
BGRAB (grabs the banks used by the current program) 31
BGRAB b
BGRAB "borrows" a bank from the current program and copies it into the
same bank in your accessory. If this accessory bank already exists, it
will be totally erased. When the accessory returns to the editor, the
bank you have grabbed will be automatically returned to your main
program along with any changes. b is the number of a bank from 1 to 16.
Note that this instruction can only be used inside an accessory. If
you try to include it in normal program, you'll get an appropriate
error message.
PRUN (run a program from memory)
PRUN "name"
Executes a Basic program which has been previously installed in the
Amiga's memory. This command can be used either from the direct mode,
or within a program! In effect, PRUN is very similar to a standard
procedure call, except that any bobs, sprites or music will be totally
suspended.
Note that it's impossible to call the same program twice in the same
session. After you've called it once, any further attempts will ignored
completely.
=PRG FIRST$ (read the first program loaded into memory)
p$=PRG FIRST$
This returns the name of the first Basic program installed in the
Amiga's memory. It's used in conjunction with the PRG NEXT$ command to
create a full list of all the currently available programs.
=PRG NEXT$ (returns the next program installed in memory)
p$=PRG NEXT$
PRG NETX$ is used after a PRG FIRST$ command to page through all the
programs installed in Amiga's memory. When the end of the list is
reached, a value of "" will be returned by this function. Example:
N$=Prg First$
While N$<>""
Print "Program" ";N$
N$=Prg Next$
Wend
=PSEL$ (call program selector)
n$=PSEL$("filter"[default$,title1$,title2$]
PSEL$ calls up a program selector which is indential to the one used by
the Run Other, Edit Other, Load Others, and New Others commands. This
can be used to select a program in the usual way. The name of this
program will be returned in n$. If the user has aborted from the
selector, n$ will be set to an emptry string "".
"filter" sets the type of programs which will be listed by
instruction. Typical values are:
"*.ACC" List all the accessories in memory
"*.AMOS" Only displays the AMOS programs which have been
installed.
"*.*" List all programs currently in memory.
For further details of the system see the DIR command.
default$ holds the name of a program which will be
used as a default.
title1$,title$ Contains up to two lines of text which will be
displayed at the top of the selector.
See EXAMPLE 3.4 in the MANUAL folder for a demonstration.
The HELP accessory 32
==================
Whenever the HELP key is pressed from the Editor window, AMOS
automatically executes an accessory with the name HELP.ACC if it's
available. Unlike normal accessories, this is displayed directly over
the editor window. Special access is provided to the current word you
are editing. The address of this word is placed in an address register
and can be read using the AREG function.
The editor control keys
=======================
Finally, here's a full list of the various control keys and effects:
Special keys 33
------------
ESC Takes you to direct mode
Editing keys
------------
Backspace Deletes the character to the immediate left of crsr.
DELete Deletes the character underneath the cursor
RETURN Tokenises the current line. If you move onto a line
and press RETURN it will split the line
SFT+BCKS/CTRL+Y Deletes current line
CTRL+U Undo. Return the last line when in overwrite mode.
CTRL+Q Erase the rest of chars in the line from crsr position
CTRL+I Insert a line at the current position
The cursor arrows
-----------------
Left,Right Moves cursor one space to the left/right
Up,Down Moves cursor one line up/down
SHIFT+Left,Right Positions the cursor over the previous/next word
SHIFT+up,down Move cursor to the top/bottom line of the current page
CTRL+up,down Displays the previous/next page of program
SHIFT+CTRL+up,dn Move to start/end of text
AMIGA+up Scrolls text up without moving the cursor
AMIGA+down Scrolls text down under the cursor
AMIGA+left,right Scroll program to the left/right on the current line
Program control
---------------
AMIGA+S Saves your program under a new name
AMIGA+SHIFT+S " " current name
AMIGA+L Loads a program
AMIGA+P Pushes the current program into a mem and creates a new
program.
AMIGA+F Flips between two progs stored in memory
AMIGA+T Displays next program in memory.
Cut and Paste 34
-------------
CTRL+B Set the beginning of a block
CTRL+E Set end point of a block
CTRL+C Cut block
CTRL+M Block move
CTRL+S Saves the block in memory without erasing it first
CTRL+P Paste block at current cursor position
CTRL+H Hide block.
Marks
-----
CTRL+SHIFT+(0-9) Defines a marker at the present cursor position.
CTRL+(0-9) Jumps to a mark
Search/Replace
--------------
ALT+UP Arrow Searches backwards through your program to the next
line which contains a label or procedure definition.
ALT+DOWN Arrow Searches down through yur program to find the next
label or procedure definition
CTRL+F Find
CRTL+N Find Next
CTRL+R Replace
Tabs
----
TAB Move the entire line at the cursor to the next TAB pos.
SHIFT+TAB Move the line to the previous Tab position
CTRL+TAB Sets the TAB value